<style type="text/css">
    .demo-upload-list {
        display: inline-block;
        width: 60px;
        height: 60px;
        text-align: center;
        line-height: 60px;
        border: 1px solid transparent;
        border-radius: 4px;
        overflow: hidden;
        background: #fff;
        position: relative;
        box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
        margin-right: 4px;
    }

    .demo-upload-list img {
        width: 100%;
        height: 100%;
    }

    .demo-upload-list-cover {
        display: none;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, .6);
    }

    .demo-upload-list:hover .demo-upload-list-cover {
        display: block;
    }

    .demo-upload-list-cover i {
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        margin: 0 2px;
    }

    .selected-search {
        box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
        height: 200px;
        width: 260px;
        position: relative;
        border-radius: 4px;
    }

    .selected-search .search-action {
        position: absolute;
        top: 10px;
        left: 10px;
        right: 10px;
    }

    .selected-search .selected-arr {
        position: absolute;
        top: 50px;
        left: 20px;
        right: 20px;
        bottom: 10px;
        overflow: scroll;
    }

    .select-click {
        border: 1px solid #dddee1;
        border-radius: 4px;
        padding: 0 10px;
        margin-bottom: 10px;
    }

    .selected-search .selected-arr .selected-item {
        /*border-bottom: 1px solid #dfdfdf;*/
    }
</style>
<template>
    <i-form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="120">
        <Form ref="formValidate" :model="formValidate" :label-width="100">
            <Form-item label="菜单名称" prop="Title">
                <i-input v-model="formValidate.Title" placeholder="请输入菜单名称"></i-input>
            </Form-item>
            <Form-item label="图标" prop="ImgUrl">
                <i-input v-model="formValidate.ImgUrl" placeholder="请输入图标"></i-input>
            </Form-item>
            <Form-item label="链接路径" prop="Url">
                <i-input v-model="formValidate.Url" placeholder="请输入链接路径"></i-input>
            </Form-item>
            <Form-item>
                <i-button @click="handleSubmitAdd('formValidate')" type="primary">提交</i-button>
                <i-button type="ghost" @click="jumpPage()" style="margin-left: 8px">返回</i-button>
            </Form-item>
        </Form>
    </i-form>

</template>
<script>
    import apiUtil from '../../assets/utils/api_util';
    import baseUtil from '../../assets/utils/base-util';

    export default {
        data() {
            return {
                formValidate: {
                    //添加字段
                    //添加字段
                    Title: '',
                    ImgUrl: '',
                    Url: '',
                    PrevId: '',
                },
                ruleValidate: {
                },
                prevId: '',
            }
        },
        mounted: function () {
            if (this.$route.query.id) {
                this.prevId = this.$route.query.id;
            }
        },

        methods: {
            //跳转
            jumpPage: function (id, url) {
                this.$router.back(-1)

            },
            handleSubmitAdd(name) {
                let that = this;
                let model = this.$refs[name].model;
                // this.$refs[name].validate((valid) => {
                    that.comfirmModifyPSAdd(model);
                // })
            },
            comfirmModifyPSAdd: function (model) {
                let that = this;
                let params = {};
                console.log('model:', model);
                model.PrevId = this.prevId;

                params = that.$qs.stringify(model);
                console.log('params:', params);
                apiUtil.post(that, apiUtil.urls.AddNavMenu, params, function (res) {
                    that.$Message.info('添加成功 ');
                });
            },

        }
    }
</script>
